//
//  CZMainTop.m
//  YingKeLive
//
//  Created by 西瓜大浪 on 2021/9/2.
//

#import "CZMainTop.h"

@implementation CZMainTop

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        self.backgroundColor = [UIColor redColor];
        NSArray *dataList  = @[@"关注",@"热门",@"附近"];
        
        CGFloat btnW = SREENWIDTH / dataList.count;
        CGFloat btnH = SREENHEIGHT;
       
        for(int i = 0; i < dataList.count  ; i++){
            
            UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
            //设置按钮文字
            [btn setTitle:@"确定" forState:UIControlStateNormal];

            [btn setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];
            btn.titleLabel.font = [UIFont systemFontOfSize:18];
            
            btn.frame = CGRectMake(i * btnW, 0, btnW, btnH);
            btn.tag = i;
            
            [btn addTarget:self action:@selector(titleClick:) forControlEvents:UIControlEventTouchUpInside];
        }
        

        
    }
    return self;
}

-(void)titleClick:(UIButton *)sender
{
    
    CZFunc
    
}
    
@end
